home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 July / EnigmA AMIGA RUN 09 (1996)(G.R. Edizioni)(IT)[!][issue 1996-07 & 08][EARSAN CD VIII].iso / earcd / util3 / ais.lha / AIS / AIS_Edge.edge < prev    next >
Text File  |  1996-02-14  |  3KB  |  51 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*             Calculate total size of files in Aminet index            */
  4. /*                                                                      */
  5. /*                    P-O Yliniemi (peoyli@pluggnet.se)                 */
  6. /*                                                                      */
  7. /*                              13-Jun-95                               */
  8. /*                                                                      */
  9. /* Place the cursor at the beginning of the first line to include in    */
  10. /* the calculation before executing this script!                        */
  11. /*                                                                      */
  12. /* The script is written for Edge v1.70, but can easily be changed to   */
  13. /* work with most other editors (that supports ARexx, of course).       */
  14. /*                                                                      */
  15. /* If Edge crashes while executing this script, try to increase Edge's  */
  16. /* stack size (crashed twice with stack size of 40K, but works fine     */
  17. /* when I increased it to 640K).                                        */
  18. /*                                                                      */
  19. /************************************************************************/
  20.  
  21. options results
  22.  
  23. GetEnvVar _FE_Lines                 /* Get number of lines in index     */
  24. numfiles=result
  25. GetEnvVar _WE_Line                  /* Get current line number          */
  26. numfiles=numfiles-result-1          /* Calculate number of files        */
  27.  
  28. totalsize=0 ; realfiles=0           /* Reset result variables           */
  29.  
  30. do numfiles
  31.     GoToColumn 32                   /* Go to the size column            */
  32.  
  33.     GetEnvVar _WE_Column            /* Get current column number        */
  34.     if result=31 then do            /* Go to next line if on an empty   */
  35.         MarkBlock ; Cursor Right 4      /* Mark the size                    */
  36.         sizemult=1                      /* Number to multiply size with     */
  37.         GetEnvVar _WE_ASCII             /* Get ASCII code for current char  */
  38.         if result=77 then sizemult=1024 /* Multiply 'M' with 1024 to get 'K'*/
  39.         if result~=63 then do           /* Exit if no specified size        */
  40.             Cursor Left 0               /* Move one char back to skip 'K'   */
  41.             Copy RB                     /* Copy to result buffer            */
  42.             size=result*sizemult        /* Save size                        */
  43.             totalsize=totalsize+size    /* Add to total                     */
  44.         end
  45.         realfiles=realfiles+1           /* Increment file counter           */
  46.         BlockOff                        /* Turn off block mode              */
  47.     end
  48.     Cursor Down 1                       /* Move to next filename            */
  49. end
  50. 'RequestNotify "Total size of 'realfiles' files: 'totalsize'K = 'TRUNC(totalsize/1024,1)'M"'
  51.